TARGET = turtle

turtle: data.cmo tools.cmo turtle.cmo lexer.cmo main.cmo
	ocamlc -thread graphics.cma unix.cma threads.cma -o $@ data.cmo tools.cmo lexer.cmo turtle.cmo main.cmo

turtle.cmo: turtle.ml turtle.cmi
	ocamlc -c turtle.ml

tools.cmo: tools.ml
	ocamlc -c $<

data.cmo: data.ml
	ocamlc -c $<

%.cmo: %.ml
	ocamlc -c $<

lexer.ml: lexer.mll
	ocamllex $<

turtle.ml: turtle.mly
	ocamlyacc $<

turtle.cmi: turtle.mli
	ocamlc -c $<

clean:
	rm -rf *.cmi *.cmo $(TARGET)
	rm -rf turtle.ml turtle.mli lexer.ml lexer.mli
